<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>VueDome3</title>
</head>
<body>
    <div id="example">
        <p>{{ foo }}</p>
        <button v-on:click="foo = 'baz'">Change It</button>
    </div>
</body>
<script type="text/javascript">
    var data = {a: 1};
    var vm = new Vue({
        el: '#example',
        data: data,
    })
    console.log(vm.$data === data);
    console.log(vm.$el === document.getElementById('example'));
    vm.$watch('a', function (newValue, oldValue) {
        
    });


    // 冒泡排序
    function bubbleSort (arr) {
        for (var i = 0; i < arr.length; i ++) {
            for (var j = 0; j < arr.length - i - 1; j ++) {
                if (arr[j] > arr[j + 1]) {
                    var item = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = item;
                }
            }
        }
        return arr;
    }
    var arr = [2, 1, 3, 6, 4, 5];
    var newArr = bubbleSort(arr);


    console.log(newArr);
    // set

    var arr = [2, 1, 3, 2, 3, 6, 4, 5];
    var newArr = new Set(arr);


    setInterval(function () {
        console.log("Select someone you like in this world.");
    }, 1000);



</script>
</html>